package com.niit.project.controller;

import com.niit.project.service.UserGoodsService;
import com.niit.project.service.impl.UserGoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.*;
import javax.servlet.http.*;
import java.io.IOException;

//已废弃
@WebServlet(name = "UserSearchController", value = "/UserSearchController")
public class UserSearchController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String option = request.getParameter("option");
        System.out.println("接收搜索数据  "+option);
        UserGoodsService userGoodsService = new UserGoodsServiceImpl();
        userGoodsService.showSelectSearch(option);
        System.out.println("执行搜索...");
        request.setAttribute("option",option);
        response.sendRedirect(request.getContextPath()+"/select.jsp");

    }
}
